#ifndef BLOG_UTILS_H
#define BLOG_UTILS_H 1

#include "builtins.h"

void
blog_utils_init(void *db_handle);

void
blog_utils_free(void);

int
blog_create_tables(void);

int
blog_upublish_link(void *dbhndl, bool publish, const char *link);

int
blog_new_blog_entry(void *dbhndl, const char *link, const char *title, const char *content, const char *author, const char *category, time_t date);

int
blog_new_blog_entry_sd(void *dbhndl, const char *link, const char *title, const char *content, const char *author, const char *category, const char *date);

void
blog_show_posts(void *dbhndl, string_t **result, const tmpl_t *t, tmpl_data_t *tdata, const char *limit);

void
blog_show_post_content(void *dbhndl, string_t **result, const tmpl_t *t, tmpl_data_t *tdata, const char *link);

int
blog_add_catg(void *dbhndl, const char *nice_name, const char *name);

int
blog_add_tag(void *dbhndl, const char *cname, const char *nname);

int
blog_tag_inc(void *dbhndl, const char *cname);

int
blog_tag_dec(void *dbhndl, const char *cname);

int
blog_add_tagpost(void *dbhndl, const char *link, const char *tag_cname);

int
blog_add_comment(void *dbhndl, const char *post_id, const char *author, const char *url, const char *comment, time_t date);

void
blog_show_comments(void *dbhndl, const char *post_id, const char *start_date, const char *limit);

int
blog_inc_view(void *dbhndl, const char *link);

#endif
